import 'package:flutter/material.dart';
import 'package:flutter_jd/pages/tabbar/category/controller.dart';
import 'package:get/get_state_manager/get_state_manager.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

class CategoryMenu extends GetWidget<CategoryController> {
  @override
  Widget build(BuildContext context) {
    return Container(
      width: 110.h,
      color: Color(0xFFF6F6F6),
      child: ListView(
        children: List.generate(
          controller.menuList.length,
          (index) => GestureDetector(
            onTap: () {
              controller.currentIndex.value = index;
            },
            child: Obx(
              () => Container(
                height: 45.h,
                decoration: BoxDecoration(
                  color: controller.currentIndex.value == index
                      ? Colors.white
                      : Color(0xFFF6F6F6),
                  borderRadius: BorderRadius.only(
                    topLeft: Radius.circular(15.r),
                    bottomLeft: Radius.circular(15.r),
                  ),
                ),
                alignment: Alignment.center,
                child: Text(
                  controller.menuList[index],
                  style: TextStyle(
                    color: controller.currentIndex.value == index
                        ? Colors.black
                        : Color(0xFF666666),
                    fontSize:
                        controller.currentIndex.value == index ? 15.sp : 14.sp,
                    fontWeight: controller.currentIndex.value == index
                        ? FontWeight.w600
                        : FontWeight.w400,
                  ),
                ),
              ),
            ),
          ),
        ),
      ),
    );
  }
}
